import { applyMiddleware, createStore } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
import thunk from 'redux-thunk'
import { createLogger } from 'redux-logger/src'
import blogReducer from '../reducers'

//异步中间件
const middleware = [thunk]

// 利用redux-logger打印日志
const logger = createLogger({
  collapsed: true,
})

middleware.push(logger)
const store = createStore(blogReducer, composeWithDevTools(applyMiddleware(...middleware)))

export default store
